<!DOCTYPE html>
<html lang="en">

<head>
  <title>second page</title>
</head>

<body>
  <h1>second page</h1>
  <a href="./10-无限滚动&回到顶部.html">嘿嘿嘿</a>
  <button onclick="myBack()">返回</button>
  <button onclick="myForward()">下一页</button>
  <button onclick="myGo()">去到第几条历史记录</button>
  <button onclick="myPushState()">插入一条新的历史记录</button>
  <button onclick="myReplaceState()">替换当前历史记录</button>
  <button onclick="historyInfo()">打印历史信息</button>
  <script type="text/javascript">
    function myBack() {
      //返回上一页
      history.back()
    }
    function myForward() {
      //去到下一页
      history.forward()
    }
    function myGo() {
      //去到第几个历史记录页面
      history.go(1)
    }
    function myPushState() {
      //插入一条新的历史记录,位于第二页
      // history.pushState({}, null, "./12-日期.html");
      history.pushState({}, null);
    }
    function myReplaceState() {
      //替换当前历史记录
    }
    function historyInfo() {
      // 打印历史记录相关信息
      console.log(history);
    }
  </script>
</body>

</html>